<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增销售单')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-order-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">商品ID：</label>
                <div class="col-sm-8">
                    <input name="goodsId"  class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">商品名称：</label>
                <div class="col-sm-8">
                    <input name="goodsName"  class="form-control" type="text" required >
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">商品价格：</label>
                <div class="col-sm-8">
                    <input name="goodsPrice" class="form-control" type="text" min="0"  required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">数量：</label>
                <div class="col-sm-8">
                    <input name="mount" th:value="1" class="form-control" type="text" required min="1">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">客户：</label>
                <div class="col-sm-8">
                    <select name="customer" class="form-control m-b" th:with="type=${@dict.getType('customer')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">售价：</label>
                <div class="col-sm-8">
                    <input name="orderPrice" class="form-control" min="1" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "business/order"
        $("#form-order-add").validate({
            rules:{
                dictSort:{
                    goodsPrice:true,
                    goodsName:true,
                    mount:true,
                    orderPrice:true
                },
            },
            focusCleanup: true
        });


        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-order-add').serialize());
            }
        }
    </script>
</body>
</html>